package com.esri.core.renderer;

import com.esri.core.internal.util.d;
import java.io.StringWriter;
import java.util.Arrays;
import org.codehaus.jackson.JsonGenerator;

/* loaded from: classes.dex */
public class RGBRenderer implements RasterRenderer {
    private static final long a = -1034759416674605085L;
    private static final String b = "rgb";
    private StretchParameters c = null;
    private int[] d = new int[0];

    public void setBandIds(int[] iArr) {
        if (iArr == null) {
            throw new IllegalArgumentException("Input bandIds cannot be null.");
        }
        this.d = Arrays.copyOf(iArr, iArr.length);
    }

    public int[] getBandIds() {
        int[] iArr = this.d;
        return Arrays.copyOf(iArr, iArr.length);
    }

    public StretchParameters getStretchParameters() {
        return this.c;
    }

    public void setStretchParameters(StretchParameters stretchParameters) {
        this.c = stretchParameters;
    }

    @Override // com.esri.core.renderer.RasterRenderer
    public String toJson() throws Exception {
        StringWriter stringWriter = new StringWriter();
        JsonGenerator a2 = d.a(stringWriter);
        a2.writeStartObject();
        toJson(a2);
        a2.writeEndObject();
        a2.close();
        return stringWriter.toString();
    }

    protected void toJson(JsonGenerator jsonGenerator) throws Exception {
        d.a(jsonGenerator, "type", b);
        int[] iArr = this.d;
        if (iArr != null && iArr.length > 0) {
            d.a(jsonGenerator, "bandIds", iArr);
        }
        StretchParameters stretchParameters = this.c;
        if (stretchParameters != null) {
            stretchParameters.a(jsonGenerator);
        }
    }
}
